﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Timers;

namespace UserInterface
{
    [Serializable()]
    public class TLPedestrian : TrafficLight
    {
        Lane deplane;
        Pedestrian pedo;
        Pedestrian[] pedArray;

        public Lane departure
        {
            get { return this.deplane; }
            set { this.deplane = value; }
        }

        public Pedestrian ped
        {
            get { return this.pedo; }
            set { this.pedo= value; }
        }
        

        /// <summary>
        /// The constructor.
        /// </summary>
        public TLPedestrian(string nm, Point p, Color c)
            : base(nm, p, c)
        {
            pedArray = new Pedestrian[5];

        }

        /// <summary>
        /// the fields sensorclicked will be used when the sensor is touched by the pedestrians, and will turn true.
        /// Otherwise, it will remain false. 
        /// </summary>
        //public bool sensorClicked()
        //{

        //    //Make a list of the location (lane) where pedo is generated
        //    //Use the list to take the generated pedo here
        //    //The sensor(s) of the lane will turn 'true' when the list is listed with laneID
        //    //


        //    //foreach (Pedestrian p in thePedo)
        //    //{
        //    //  if (p = //generated pedo)
        //    //  {
        //    //      return laneID;
        //    //  }
        //    //  else
        //    //  {
        //    //      return "";
        //    //  }
        //    //}

        //   /*
        //    * if (//laneID is listed)
        //    * {return true; //in every lane
        //    * }
        //    * 
        //    */
        //    return false;

        //}



        /// <summary>
        /// The result of the sensor being touched.
        /// </summary>
        public bool Sensor(Lane depLane)
        {

            foreach (Pedestrian ped in pedArray)
            {
                if (ped == pedo)
                {
                    depLane = deplane;
                    return true;
                }
                return false;
            }
            return false;
        }




    }
}
